package ar.edu.caece.dns.modelo.socket;

import java.net.Socket;

import ar.edu.caece.dns.modelo.servidor.Servidor;

/**
 * Clase que contruye un RequestController, vinculando un servidor y un socket.
 * 
 * @author Portillol
 * 
 */
public class RequestControllerBuilder {

	private Servidor servidor;

	private Socket socket;

	public RequestControllerBuilder() {
		super();
	}

	public RequestControllerBuilder with(Socket socket) {
		this.socket = socket;
		return this;
	}

	public RequestControllerBuilder with(Servidor servidor) {
		this.servidor = servidor;
		return this;
	}

	/**
	 * Crea una nueva instancia de RequestController, con los datos de servidor
	 * y socket definidos previamente por with()
	 * 
	 * @return
	 */
	public RequestController build() {
		
		RequestController requestController = new RequestController();
		requestController.setServidor(this.servidor);
		requestController.setSocket(this.socket);

		return requestController;
	}

}
